Early Preview
This is currently very much a preview. Please feel free to try things out,
but don't be upset if anything is not yet working. Feedback is welcome over on our
GitHub Dicussions page.
class Microsoft.​AspNetCore.​Authentication.​AuthenticationHandler<​TOptions>
Assembly: Microsoft.AspNetCore.Authentication
Inheritance: object → AuthenticationHandler
Implemented Interfaces
An opinionated abstraction for implementing <see cref="T:Microsoft.AspNetCore.Authentication.IAuthenticationHandler" /> .
Properties
public
AuthenticationScheme
Scheme
Gets or sets the <see cref="T:Microsoft.AspNetCore.Authentication.AuthenticationScheme" /> associated with this authentication handler.
public
TOptions
Options
Gets or sets the options associated with this authentication handler.
protected
Http.​HttpContext
Context
Gets or sets the <see cref="T:Microsoft.AspNetCore.Http.HttpContext" /> .
protected
Http.​HttpRequest
Request
Gets the <see cref="T:Microsoft.AspNetCore.Http.HttpRequest" /> associated with the current request.
protected
Http.​HttpResponse
Response
Gets the <see cref="T:Microsoft.AspNetCore.Http.HttpResponse" /> associated with the current request.
protected
Http.​PathString
OriginalPath
Gets the path as seen by the authentication middleware.
protected
Http.​PathString
OriginalPathBase
Gets the path base as seen by the authentication middleware.
Logger
Gets the <see cref="T:Microsoft.Extensions.Logging.ILogger" /> .
protected
System.​Text.​Encodings.​Web.​UrlEncoder
UrlEncoder
Gets the <see cref="P:Microsoft.AspNetCore.Authentication.AuthenticationHandler`1.UrlEncoder" /> .
protected
ISystemClock
Clock
Gets the <see cref="T:Microsoft.AspNetCore.Authentication.ISystemClock" /> .
protected
System.​TimeProvider
TimeProvider
Gets the current time, primarily for unit testing.
protected
Extensions.​Options.​IOptionsMonitor<​TOptions>
OptionsMonitor
Gets the <see cref="T:Microsoft.Extensions.Options.IOptionsMonitor`1" /> to detect changes to options.
protected
object
Events
The handler calls methods on the events which give the application control at certain points where processing is occurring.
If it is not provided a default instance is supplied which does nothing when the methods are called.
protected
string
ClaimsIssuer
Gets the issuer that should be used when any claims are issued.
protected
string
CurrentUri
Gets the absolute current url.
Methods
InitializeAsync​(AuthenticationScheme scheme,
Http.​HttpContext context)
Initialize the handler, resolve the options and validate them.
InitializeEventsAsync​()
Initializes the events object, called once per request by <see cref="M:Microsoft.AspNetCore.Authentication.AuthenticationHandler`1.InitializeAsync(Microsoft.AspNetCore.Authentication.AuthenticationScheme,Microsoft.AspNetCore.Http.HttpContext)" /> .
protected
System.​Threading.​Tasks.​Task<​object>
CreateEventsAsync​()
Creates a new instance of the events instance.
Returns A new instance of the events instance.
InitializeHandlerAsync​()
Called after options/events have been initialized for the handler to finish initializing itself.
Returns A task
protected
string
BuildRedirectUri​(string targetPath)
Constructs an absolute url for the specified <paramref name="targetPath" /> .
Returns The absolute url.
targetPath
The path.
protected
string
ResolveTarget​(string scheme)
Resolves the scheme that this authentication operation is forwarded to.
Returns The forwarded scheme or <see langword="null" /> .
scheme
The scheme to forward. One of ForwardAuthenticate, ForwardChallenge, ForwardForbid, ForwardSignIn, or ForwardSignOut.
public
System.​Threading.​Tasks.​Task<​AuthenticateResult>
AuthenticateAsync​()
protected
System.​Threading.​Tasks.​Task<​AuthenticateResult>
HandleAuthenticateOnceAsync​()
Used to ensure HandleAuthenticateAsync is only invoked once. The subsequent calls
will return the same authenticate result.
protected
System.​Threading.​Tasks.​Task<​AuthenticateResult>
HandleAuthenticateOnceSafeAsync​()
Used to ensure HandleAuthenticateAsync is only invoked once safely. The subsequent
calls will return the same authentication result. Any exceptions will be converted
into a failed authentication result containing the exception.
protected
System.​Threading.​Tasks.​Task<​AuthenticateResult>
HandleAuthenticateAsync​()
Allows derived types to handle authentication.
Returns The <see cref="T:Microsoft.AspNetCore.Authentication.AuthenticateResult" /> .
HandleForbiddenAsync​(AuthenticationProperties properties)
Override this method to handle Forbid.
Returns A Task.
HandleChallengeAsync​(AuthenticationProperties properties)
Override this method to deal with 401 challenge concerns if an authentication scheme in question
deals an authentication interaction as part of its request flow (like adding a response header, or
changing the 401 result to 302 of a login page or external sign-in location).
Returns A Task.
public
bool
Equals​(object obj)
Inherited from object
protected
void
Finalize​()
Inherited from object
public
int
GetHashCode​()
Inherited from object
protected
object
MemberwiseClone​()
Inherited from object
public
string
ToString​()
Inherited from object